$(function(){
	
	/*搜索下拉框*/
	$.ajax({
		url: defaultUrl+"/sysDict/querySubject",
		data:{
			drugstoreId :7,
		},
		success:function(data){
			console.log(data);
			$('.yaoshisel').html("");
			var select = "";
			for(var i=0;i<data.obj.length;i++){
				select += '<option value="'+data.obj[i].dictCode+'">'+data.obj[i].dictName+'</option>';
			}
			$('.yaoshisel').append(select);
		}
	});
	/*下拉框改变事件*/
	$('.yaoshisel').on('change',function(){
		var zhi = $(this).val();
		$.ajax({
			url: defaultUrl+"/baseDrugstore/queryDrugstore",
			data:{
				drugstoreId :7,
				subjectCode:zhi
			},
			success:function(data){
				var html="";
				$('.content').html("");  
				html +='<div class="row list" style="margin: 0">';
				if(data.length > 0){
					for(var i=0;i<data.length;i++){
						html += '<div class="col-xs-6 col-md-3" id=""'+data[i].pharmacistId+'"">';
						if(data[i].realTimeState == 0){
							html+='<div class="thumbnail doctor-form state-nohere">';
						}else if(data[i].realTimeState == 1){
							html+='<div class="thumbnail doctor-form state-free">';
						}else if(data[i].realTimeState == 2){
							html+='<div class="thumbnail doctor-form state-busy">';
						}else if(data[i].realTimeState == 3){
							html+='<div class="thumbnail doctor-form state-goAway">';
						}
						html += '<div class="doc-head-img">';
						html += '<img src='+data[i].attachmentUrl+' alt="医生头像">';
						html += '</div>';
						html += '<div class="caption">';
						html += '<div class="doc-name-tab">';
						html += '<h4><strong>'+data[i].pharmacistName+'</strong></h4>';
						html += '<h5>'+data[i].titleName+'</h5>';
						html += '</div>';
						html += '<div class="row" style="margin: 0">';
						html += '<div class="col-xs-6 col-md-6 ">';
						html += '<p>评价：<span>'+data[i].score+'</span></p>';
						html += '</div>';
						html += '<div class="col-xs-6 col-md-6 ">';
						html += '<p>已服务：<span>'+data[i].no+'</span></p>';
						html += '</div>';
						html += '</div>';
						html += '<div class="row" style="margin: 0">';
						html += '<div class="col-xs-6 col-md-6 btn btn-success view" role="button" data-toggle="modal" data-target="#photo">处方拍照</div>';
						html += '<div class="col-xs-6 col-md-6 btn btn-info consulting" role="button" data-toggle="modal" data-target="#call">呼叫药师</div>';
						html += '</div>';
						html += '</div>';
					   	html += '</div>';
					   	html += '</div>';
					}
				}else{
						html += '<div style="font-size:20px;text-align: center;">暂无相关药师数据信息!';
				}
				html += '</div>';
				$('.content').append(html);  
			}
		});
	})
	/*获取药师列表*/
	$.ajax({
		url: defaultUrl+"/baseDrugstore/queryDrugstore",
		data:{
			drugstoreId :7,
		},
		success:function(data){
			console.log(data);
			var html="";
			$('.content').html("");  
			html +='<div class="row list" style="margin: 0">';
			for(var i=0;i<data.length;i++){
				html += '<div class="col-xs-6 col-md-3" id=""'+data[i].pharmacistId+'"">';
				if(data[i].realTimeState == 0){
					html+='<div class="thumbnail doctor-form state-nohere">';
				}else if(data[i].realTimeState == 1){
					html+='<div class="thumbnail doctor-form state-free">';
				}else if(data[i].realTimeState == 2){
					html+='<div class="thumbnail doctor-form state-busy">';
				}else if(data[i].realTimeState == 3){
					html+='<div class="thumbnail doctor-form state-goAway">';
				}
				html += '<div class="doc-head-img">';
				html += '<img src='+data[i].attachmentUrl+' alt="医生头像">';
				html += '</div>';
				html += '<div class="caption">';
				html += '<div class="doc-name-tab">';
				html += '<h4><strong>'+data[i].pharmacistName+'</strong></h4>';
				html += '<h5>'+data[i].titleName+'</h5>';
				html += '</div>';
				html += '<div class="row" style="margin: 0">';
				html += '<div class="col-xs-6 col-md-6 ">';
				html += '<p>评价：<span>'+data[i].score+'</span></p>';
				html += '</div>';
				html += '<div class="col-xs-6 col-md-6 ">';
				html += '<p>已服务：<span>'+data[i].no+'</span></p>';
				html += '</div>';
				html += '</div>';
				html += '<div class="row" style="margin: 0">';
				html += '<div class="col-xs-6 col-md-6 btn btn-success view" role="button" data-toggle="modal" data-target="#photo">处方拍照</div>';
				html += '<div class="col-xs-6 col-md-6 btn btn-info consulting" role="button" data-toggle="modal" data-target="#call">呼叫药师</div>';
				html += '</div>';
				html += '</div>';
			   	html += '</div>';
			   	html += '</div>';
			}
			html += '</div>';
			$('.content').append(html);  
			
		}
	});
	
})
